﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataBaseLibrary.DBInterfaces;
using System.ComponentModel;

namespace DataBaseLibrary.DBObjectsFB
{
    /// <summary>
    /// Описывает данные о компьютере (индекс машины)
    /// </summary>
    public class RegisterComputerInfo: DBFObject, IDBObject, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, e);
        }

        private String m_IndexComputer = "";
        public String IndexComputer
        {
            get
            {
                return m_IndexComputer;
            }
            set
            {
                m_IndexComputer = value;
                OnPropertyChanged(new PropertyChangedEventArgs("DopVin"));
            }
        }

        public RegisterComputerInfo()
        {
            NameTable = "REGISTER_PROGRAMM_INFO ";

        }

        void IDBObject.Update()
        {
            Parameters = new Dictionary<string, object>();
            Parameters.Add("INDEX_COMPUTER", IndexComputer);

            UpdateObject();
        }

        void IDBObject.Load(object ID)
        {
            Parameters = new Dictionary<string, object>();
            Parameters.Add("INDEX_COMPUTER", IndexComputer);
            LoadObject("0");
            IndexComputer = (String)Parameters["INDEX_COMPUTER"];
        }

        object IDBObject.Save()
        {
            throw new NotSupportedException("Метод не поддерживается");
        }
    }
}
